Create
Create Create a new empty file (data fork only) Str255 fileName ; address of length-prefixed full or partial name short vRefNum ; volume or directory reference number OSType creator ; 32-bit creator ID (your app's signature) OSType fileType ; 32-bit file type (e.g., 'TEXT' or custom type) Create creates a new file with an empty data fork and initializes the information the Finder will need to start your application if the file is clicked
from the desktop. Note that the file is NOT opened. No resource fork for the
file is created.
fileName is the address of a length-prefixed, pascal-style string containing
the name of the file to be created. It may be a partial or full
pathname, depending upon the value of vRefNum . You should NOT use names beginning with a period (".") since that convention is reserved
for devices. Imagine what happens when you create and write to a
file named ".Sony" (it's not a pretty sight when your hard disk goes
south).
vRefNum is the reference number of the volume or directory containing fileName . See FSOpen for a description of the options. creator is a 32-bit value, often expressed as a four-letter literal (e.g.,
'MSWD'). It is normally the unique signature of your application
(as registered with Apple), or the signature of the application you
want to be launched when this file is double-clicked in the Finder.
Note: use creator = '????' if you don't want the file to auto-start any application.
fileType is a 32-bit value, normally expressed as a four-letter literal (e.g.,
'TEXT'). It identifies the file type, which helps applications
determine how to process the file. This value is used in file filtering
noErr (0) No error
bdNamErr (-37) Bad name
dirFulErr (-33) Directory full
dupFNErr (-48) Duplicate filename (rename)
extFSErr (-58) External file system
ioErr (-36) I/O error
nsvErr (-35) No such volume
vLckdErr (-46) Volume is locked
wPrErr (-44) Diskette is write-protected
Notes: Use SetFInfo for control over other de scriptive information about the file, such as the Finder's placement of the file's icon in its folder, whether
or not the file has a bundle of de scriptive resources, and whether the file's
icon is in visible.
may wish to use Allocate or SetEOF or PBAllocContig to pre-allocate as much storage as the file will need.